* -------------------------------------------------------------------------------------------------------------------------------------------- *
* Master do-file for repliaction package for paper "Formalizing employment in Africa's small firms: Experimental evidence from Côte d'Ivoire"  *	
* Authors: Katharina Fietz, Tabea Lakemann, Bernd Beber, Jan Priebe, Jann Lay																   *
* -------------------------------------------------------------------------------------------------------------------------------------------- *

clear 		all 
global 		userpath 			"C:\Users\katharina.fietz\GIGA\ReUsSITE - WP1 Data - CI Data folders\Internal - data folder\4_dofiles\Paper II\ind\replication"
global 		code 				"$userpath\01_code"
global 		data 				"$userpath\02_data"
global		results				"$userpath\03_results"

***** Definitions 
* Samples 
global sample1 				"if wave==2 & employer==0 & inlist(status,1,2,4)" // Includes new employees, excludes employers, excludes leavers 
global sample2 				"if wave==3 & employer==0 & inlist(status,1,2,4)" // Includes new employees, excludes employers, excludes leavers & employer==0
global sample3 				"if inlist(wave,2,3) & employer==0 & inlist(status,1,2,4)" // // & panel_pooled==1 Includes new employees, excludes employers, excludes leavers & employer==0 

global outcomes    			aminwage wrcon  sosec   empquality_ind 
global outcomes2 			lwage  satisfied hoursworked training_any 
global outcomes_firm 		revenue_wins5 ihsrev  prod_labour_wins5 prl costs_labour_wins5  ihscosts_labour lc_pc_wins5 ihslc_pc profit_wins5 ihsprof
global outcomes_firm_2 		emp lemp

* SEs & strata
global se_indiv ", a(strata_all_coll) vce(cl id)"  	
global controls_balance   educ_tert_base  i.ag_ano  

clear all 

*STOP

* ----------------- * 
* Prepare Analysis  * 
* ----------------- *

run "$code/1A_analysis_prepare" 

* ----------------- * 
* Table 1, S.4, S.5 * 
* ----------------- * 

run "$code/1A_balance_individual.do" 

* ----------------- * 
* Table 2			* 
* ----------------- * 

run "$code/1A_attrition.do" 

* ----------------- * 
* Table 3			* 
* ----------------- * 

run "$code/2A_analysis_main.do" 

* ----------------- * 
* Table 4			* 
* ----------------- * 

run "$code/2A_analysis_firm.do" 

* ----------------- * 
* Table 5, 6, S2	* 
* ----------------- * 

run "$code/2B_analysis_het.do" 
run "$code/2B_analysis_het_baseline_value.do" 
run "$code/2B_analysis_het_baseline_wage.do" 

* ----------------- * 
* Table 7			* 
* ----------------- * 

run "$code/2A_analysis_isp.do" 

* ----------------- * 
* Figure S1			* 
* ----------------- * 

run "$code/1B_descriptives_cost_gap.do" 


* ----------------- * 
* Figure S2			* 
* ----------------- * 

run "$code/1B_descriptives_figures.do" 

* ----------------- * 
* Table S1			* 
* ----------------- * 

run "$code/2C_robustness_mainresults_no_controls.do" 

* ----------------- * 
* Table S3			* 
* ----------------- * 

*run R Script "2B_CLAN"

* ----------------- * 
* Table S6, S7		* 
* ----------------- * 

run "$code/1A_balance_firm.do" 

* ----------------- * 
* Table S8			* 
* ----------------- * 

run "$code/1B_WBES.do" 

* ----------------- * 
* Table S9, S10, S13* 
* ----------------- * 

run "$code/1B_descriptives.do" 

* ----------------- * 
* Table S11, S15	* 
* ----------------- * 

run "$code/2C_robustness_missreporting.do" 

* ----------------- * 
* Table S12			* 
* ----------------- * 

run "$code/2A_wage_bill.do" 

* ----------------- * 
* Table S14			* 
* ----------------- * 

run "$code/2A_analysis_contract_type.do" 

* ----------------- * 
* Table S16			* 
* ----------------- * 

run "$code/2C_robust_firm_level_weighting.do" 

* ----------------- * 
* Table S17			* 
* ----------------- * 

run "$code/2C_robustness_lee_bounds.do" 

* ----------------- * 
* Table S18			* 
* ----------------- * 

run "$code/2C_robustness_ipw.do" 

* ----------------- * 
* Table S19			* 
* ----------------- * 

run "$code/2A_analysis_firm_knowledge.do" 

* ----------------- * 
* Table S20			* 
* ----------------- * 

run "$code/2A_mediate.do" 

* ----------------- * 
* Table S21			* 
* ----------------- * 

run "$code/2B_anaysis_het_retention.do" 








